﻿using Basic.FlowGatewayModule.Interface;
using Basic.FlowRemoteModel.EventTemplate.Model;
using WeDonekRpc.ApiGateway.Attr;
using WeDonekRpc.Client;
using WeDonekRpc.Helper.Validate;
using WeDonekRpc.HttpApiGateway;
using WeDonekRpc.HttpApiGateway.Model;

namespace Basic.FlowGatewayModule.Api
{
    [ApiRouteName("/flow/event/inter/{name}")]
    internal class FlowEventInterApi : ApiController
    {
        private readonly IFlowEventInterService _Service;

        public FlowEventInterApi ( IFlowEventInterService service )
        {
            this._Service = service;
        }

        public long Add ( EventTemplateAdd data )
        {
            data.CreateBy = base.UserState.ToEmpId();
            return this._Service.Add(data);
        }

        public void Delete ( [NumValidate("flow.event.inter.id.error", 1)] long id )
        {
            this._Service.Delete(id);
        }

        public EventInterDto Get ( [NumValidate("flow.event.inter.id.error", 1)] long id )
        {
            return this._Service.Get(id);
        }

        public EventInterItem[] GetItems ()
        {
            return this._Service.GetItems();
        }

        public PagingResult<EventInter> Query ( PagingParam<InterQueryParam> param )
        {
            return this._Service.Query(param);
        }
        public bool Enable ( [NumValidate("flow.event.inter.id.error", 1)] long id )
        {
            return this._Service.Enable(id);
        }
        public bool Disable ( [NumValidate("flow.event.inter.id.error", 1)] long id )
        {
            return this._Service.Disable(id);
        }
        public bool Set ( LongParam<EventTemplateSet> param )
        {
            return this._Service.Set(param.Id, param.Value);
        }
    }
}
